//
//  UIListView.h
//  List
//
//  Created by Hunk on 12-2-11.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "EGORefreshTableHeaderView.h"

@protocol UIListViewDelegate;
@protocol UIListViewDataSource;
@interface UIListView : UIView <UITableViewDataSource, UITableViewDelegate, EGORefreshTableHeaderDelegate, UIScrollViewDelegate>
{
    @private
    // TableView
    UITableView               *_tableView;
    
    // Refresh header view
    EGORefreshTableHeaderView *_refreshHeaderView;
    
    // Reloading flag for fresh table
    BOOL                      _bIsReloading;
    
    // Delegate
    id<UIListViewDelegate>    _delegate;
    // DataSource
    id<UIListViewDataSource>  _dataSource;
    
    // ListView data array
    NSMutableArray            *_listViewDataArray;
    
    // Has more
    BOOL                      _hasMore;

    // Reset listView
    BOOL                      _resetListView;
}
@property (nonatomic, assign) id<UIListViewDelegate>   delegate;
@property (nonatomic, assign) id<UIListViewDataSource> dataSource;
@property (nonatomic, assign) BOOL                     hasMore;
@property (nonatomic, assign) BOOL                     resetListView;

- (void)appendDataArray:(NSArray *)dataArray;

- (void)finishRefreshListView;

- (void)scrollListView;

@end


// UIListViewDelegate
@protocol UIListViewDelegate <NSObject>

// Refresh listView
- (void)refreshListView:(UIListView *)listView;

// Fetch more data
- (void)fetchMoreData:(UIListView *)listView;

@end

@protocol UIListViewDataSource <NSObject>

// Number of rows
- (NSInteger)numberOfRowsInListView:(UIListView *)listView;

- (CGFloat)heightForRowInListView:(UIListView *)listView;

@end
